import com.zjh.mybase.config.SpringConfig;
import com.zjh.mybase.mapper.TalkMapper;
import com.zjh.mybase.service.UserService;
import com.zjh.mybase.vo.TalkVO;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {SpringConfig.class})
public class Done {
    @Autowired
    private UserService userService;

    @Autowired
    private TalkMapper talkMapper;

    @Test
    public void data(){
        System.out.println("123456");
        System.out.println(userService.getById(1L));
    }

    @Test
    public void mybatisOneToMany(){
        System.out.println("123456");
        //一对多
        System.out.println(talkMapper.show(27L));
        //多对多

    }

    @Test
    public void manyToMany(){
        System.out.println("mybatis 多对多的使用形式--------------------------");
        List<TalkVO> list = talkMapper.list(new Object());
        System.out.println("数量:"+ list.size());
       for(TalkVO item : list){
           System.out.println(item);
       }
    }
}
